package org.cnc.gui;

import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.LayoutStyle.ComponentPlacement;

@SuppressWarnings("serial")
public class DrawerSettings extends JPanel
{
	private JTextField txtServerPort;
	private JTextField txtServerName;

	public DrawerSettings()
	{
		
		JLabel lblServerPort = new JLabel("Server port:");
		lblServerPort.setFont(new Font("Tahoma", Font.PLAIN, 16));
		
		txtServerPort = new JTextField();
		txtServerPort.setFont(new Font("Tahoma", Font.PLAIN, 17));
		txtServerPort.setColumns(10);
		
		JLabel lblCurrentStatus = new JLabel("Current status");
		lblCurrentStatus.setFont(new Font("Tahoma", Font.PLAIN, 16));
		
		JLabel label = new JLabel();
		label.setFont(new Font("Tahoma", Font.PLAIN, 16));
		
		JButton btnOk = new JButton("Save");
		btnOk.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				
			}
		});
		
		JLabel lblServerName = new JLabel("Server name:");
		lblServerName.setFont(new Font("Tahoma", Font.PLAIN, 16));
		
		txtServerName = new JTextField();
		txtServerName.setFont(new Font("Tahoma", Font.PLAIN, 16));
		txtServerName.setColumns(10);
		
		GroupLayout groupLayout = new GroupLayout(this);
		groupLayout.setHorizontalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(groupLayout.createSequentialGroup()
					.addContainerGap()
					.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
						.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
							.addGroup(groupLayout.createSequentialGroup()
								.addComponent(lblServerPort)
								.addGap(28))
							.addGroup(groupLayout.createSequentialGroup()
								.addComponent(lblServerName)
								.addGap(18)))
						.addComponent(lblCurrentStatus))
					.addGap(28)
					.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
						.addComponent(label, GroupLayout.DEFAULT_SIZE, 155, Short.MAX_VALUE)
						.addComponent(txtServerPort, GroupLayout.DEFAULT_SIZE, 155, Short.MAX_VALUE)
						.addComponent(txtServerName, GroupLayout.DEFAULT_SIZE, 146, Short.MAX_VALUE))
					.addGap(100)
					.addComponent(btnOk, GroupLayout.PREFERRED_SIZE, 62, GroupLayout.PREFERRED_SIZE)
					.addContainerGap())
		);
		groupLayout.setVerticalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(groupLayout.createSequentialGroup()
					.addContainerGap()
					.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
						.addComponent(btnOk)
						.addComponent(lblServerPort)
						.addComponent(txtServerPort, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
					.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
						.addComponent(lblServerName)
						.addComponent(txtServerName, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(ComponentPlacement.UNRELATED)
					.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
						.addComponent(label, GroupLayout.PREFERRED_SIZE, 26, GroupLayout.PREFERRED_SIZE)
						.addComponent(lblCurrentStatus))
					.addContainerGap())
		);
		setLayout(groupLayout);

	}
}
